

template <typename T> struct SbNullable
{
private:
  T     value_;
  bool  has_value_;

public:
  SbNullable() : has_value_(false) {
  }

  SbNullable(T const& value) : value_(value), has_value_(true) {
  }

  bool hasValue() const { 
    return has_value_; 
  }
 
  void operator=(Nullable<T> const& other) { 
    value_    = other.value_;
    has_value = other.has_value_;
  }
 
  void operator=(T const& value) { 
    value_ = value; 
    has_value_ = true; 
  }

  bool operator==(Nullable<T> const& other) const {
    return has_value_ ? (other.value_ == value_) : !other.has_value;
  }

  bool operator==(T const& value) const {
    return has_value_ && (value == value_);
  }
};